package design.simdi.code.final_paper.core.entities;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 
 * @author Marius Dumitriu - (Jun 2, 2010 - 11:41:21 PM)
 * 
 */
@Entity
@Table(name = "rolepermissions")
@AttributeOverrides( { @AttributeOverride(name = "id", column = @Column(name = "RolePermission_Id")) })
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class RolePermission extends ApplicationEntity {

	private static final long serialVersionUID = 1L;
	private Role role;
	private Permission permission;


	/**
	 * @return the group
	 */
	@ManyToOne
	@JoinColumn(name = "Role_Fk")
	public Role getRole() {
		return role;
	}

	/**
	 * @param group
	 *            the group to set
	 */
	public void setRole(Role role) {
		this.role = role;
	}

	/**
	 * @return the role
	 */
	@ManyToOne
	@JoinColumn(name = "Permission_Fk")
	public Permission getPermission() {
		return permission;
	}

	/**
	 * @param role
	 *            the role to set
	 */
	public void setPermission(Permission permission) {
		this.permission = permission;
	}

}
